package com.cskaoyan.day15;

public class ComputeCount {
    public static void main(String[] args) {
        String str = "woaijavawozhenaijavawozhendeaijavawozhendehenaijavaxinbuxinwoaijavagun";
        int count = 0;
        for (int i = 0; ; i++) {
            i = str.indexOf("java", i);
            if (i == -1) {
                break;
            }
            count++;
        }
        System.out.println("woaijavawozhenaijavawozhendeaijavawozhendehenaijavaxinbuxinwoaijavagun中出现java字符串的次数是:" + count);
    }
}
